package com.visitcqut.service.impl;

import com.visitcqut.domain.Student;
import com.visitcqut.mapper.StudentMapper;
import com.visitcqut.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;


/**
 * @program: visitcqut
 * @description: 学生服务实现类
 * @author: ATAO
 * @create: 2020-11-14 13:37
 **/


@Repository
public class StudentServiceImpl implements StudentService {


    /**
     * 数据库访问层
     */
    @Autowired
    StudentMapper studentMapper;


    /**
     * 添加学生
     * @param data
     * @return int
     */
    @Override
    public int insert(Student data) {
        return studentMapper.insert(data);
    }


    /**
     * 删除学生
     * @param id
     * @return int
     */
    @Override
    public int delete(Integer id) {
        return studentMapper.delete(id);
    }


    /**
     * 更新学生信息
     * @param data
     * @return int
     */
    @Override
    public int update(Student data) {
        return studentMapper.update(data);
    }


    /**
     * 根据id查找学生
     * @param id
     * @return int
     */
    @Override
    public Student findById(Integer id) {
        return studentMapper.findById(id);
    }


    /**
     * 根据查找所有学生
     * @return Student
     */
    @Override
    public List<Student> findAll() {
        return studentMapper.findAll();
    }
}
